package hu.diploma.core.service.impl;

import hu.diploma.common.service.AddressService;
import hu.diploma.common.service.PersonService;
import hu.diploma.common.vos.AddressVo;
import hu.diploma.common.vos.PersonVo;
import hu.diploma.core.dao.AddressDao;
import hu.diploma.core.entity.Address;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("AddressServiceImpl")
public class AddressServiceImpl extends BaseServiceImpl<Address, AddressVo> implements AddressService {

	@Autowired
	public void setGenericDao(AddressDao dao) {
		super.setGenericDao(dao);
	}

	@Autowired
	PersonService personService;

	@Override
	public List<AddressVo> findByPeople(PersonVo peopleVo) throws Exception {
		return personService.findById(peopleVo.getId()).getAddresses();
	}
}
